﻿ <br />
<div class="code">
<span class="Modifier">public</span>&nbsp;ActionResult&nbsp;Foreach()<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;People&nbsp;viewModel&nbsp;=&nbsp;<span class="Keyword">new</span>&nbsp;People();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;viewModel.people.Add(<span class="Keyword">new</span>&nbsp;Person()&nbsp;{&nbsp;firstName&nbsp;=&nbsp;<span class="String">"Bert"</span>,&nbsp;lastName&nbsp;=&nbsp;<span class="String">"Bertington"</span>&nbsp;});<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;viewModel.people.Add(<span class="Keyword">new</span>&nbsp;Person()&nbsp;{&nbsp;firstName&nbsp;=&nbsp;<span class="String">"Charles"</span>,&nbsp;lastName&nbsp;=&nbsp;<span class="String">"Charlesforth"</span>&nbsp;});<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;viewModel.people.Add(<span class="Keyword">new</span>&nbsp;Person()&nbsp;{&nbsp;firstName&nbsp;=&nbsp;<span class="String">"Denise"</span>,&nbsp;lastName&nbsp;=&nbsp;<span class="String">"Dentiste"</span>&nbsp;});<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Statement">return</span>&nbsp;View(viewModel);<br />
}
</div>